export const tti = {
  generationsApi: '/v1/images/generations',

  generations ({ key, ...body }: any) {
    const updatedBody = {
      n: 1,
      ...body
    }

    return $fetch(this.generationsApi, {
      method: 'post',
      body: updatedBody,
      headers: {
        Authorization: `Bearer ${key}`
      }
    }).catch((res: any) => {
      ElNotification({
        title: '系统错误',
        message: res?.response?._data?.error?.message || '未知异常',
        type: 'error'
      })
    })
  }
}
